/**
 * Created with JackHou
 * Date: 2019/3/11
 * Time: 19:59
 * Description:EventEmitter工具类
 */

import EventEmitter from 'events'

export default class EmitterUtils {

    constructor() {
        console.log('EmitterUtils constructor');
    }

    /**
     * 创建单例的EventEmitter否则多个实例之间无法传输数据
     * @returns {internal}
     */
    static getInstanceEmitter = () => {
        if (!this.emitter) {
            console.log('this.emitter is null will create a new emitter!');
            this.emitter = new EventEmitter();
        }
        return this.emitter;
    };
}